﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace TaxSetup
{
    /// <summary>
    /// Interaction logic for DialogTaxClassList.xaml
    /// </summary>
    public partial class DialogTaxZoneList : Window
    {
        private SalesManagerEntities _context;
        public tblTaxZone TaxZone = null;
        private CollectionViewSource _taxClassesViewSource;

        public DialogTaxZoneList(SalesManagerEntities context)
        {
            _context = context;
            InitializeComponent();
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            TaxZone = (tblTaxZone)_taxClassesViewSource.View.CurrentItem;
            DialogResult = true;
            Close();
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
            Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _taxClassesViewSource = (CollectionViewSource)Resources["TaxZones"];
            _taxClassesViewSource.Source = _context.tblTaxZones;
        }

        private void lstZones_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            btnOK_Click(sender, null);
        }
    }
}
